﻿
@using WikeSoft.WorkFlowEngine.Entities
@using WikeSoft.WorkFlowEngine.Models
@model WikeSoft.Enterprise.Models.HolidayAuditModel
@{
    ViewBag.Title = "调证审核";
    Layout = "~/Views/Shared/_Form.cshtml";
    String prevUrl = string.Empty;
    if (Request.UrlReferrer != null)
    {
        prevUrl = Request.UrlReferrer.ToString();
    }
}


@section scripts{
    <script type="text/javascript">


        function setAgree(val) {
            $("#Agree").val(val);
            return true;
        }


    </script>

}
@if (!String.IsNullOrEmpty(Model.InstanceId))
{


    if (ViewBag.Historys != null && ViewBag.Historys.Count > 0)
    {
        <form class="form-horizontal" method="post">
            <div class="form-group">
                <label class="col-sm-2 control-label">处理记录</label>
                <div class="col-sm-10">
                    <table class="table table-striped">
                        <tr>
                            <th>操作环节</th>
                            <th>处理人</th>
                            <th>时间</th>
                            <th>处理意见</th>
                        </tr>

                        @foreach (TaskInstance data in ViewBag.Historys)
                        {
                            <tr>
                                <td>@data.NodeDefName</td>
                                <td>@data.DealUser</td>
                                <td>@(data.DealDate.HasValue ? data.DealDate.Value.ToString("yyyy-MM-dd HH:mm:ss") : "")</td>
                                <td>@data.DealRemark</td>
                            </tr>
                        }

                    </table>

                </div>
            </div>

        </form>
    }

    if (!string.IsNullOrEmpty(Model.InstanceId))
    {

        <form class="form-horizontal" method="post">


            <div class="form-group">
                <label class="col-sm-2 control-label">流程图</label>
                <div class="col-sm-10">
                    <div class="form-group">
                        <img src="@Url.Action("Pic","WorkFlowInstance")?flowId=@Model.InstanceId&r=@Guid.NewGuid().ToString()" />
                    </div>

                </div>
            </div>

        </form>

    }


    <form class="form-horizontal" action="@Url.Action("WorkFlowAudit")" method="post">

        @Html.HiddenFor(x => x.TaskId)
        @Html.HiddenFor(x => x.InstanceId)
        @Html.HiddenFor(x=>x.Agree)
        @Html.HiddenFor(x => x.Id)

        <input type="hidden" id="redirectUrl" name="redirectUrl" value="@prevUrl" />

        <div class="form-group">
            @Html.LabelFor(x => x.Message, new { @class = "col-sm-2 control-label" })
            <div class="col-sm-10">
                @Html.TextAreaFor(x => x.Message, new { @class = "form-control", rows = "3" })
                @Html.ValidationMessageFor(x => x.Message)

            </div>
        </div>

        <div class="form-group">
            <div class="col-sm-offset-2  col-sm-10 form-inline">
                <button type="submit" class="btn btn-default" onclick="return setAgree(true)">通过 </button>

                <button type="submit" class="btn btn-default" onclick="return setAgree(false)">驳回 </button>
            </div>
        </div>



    </form>
}
else
{
    <div>未提交的数据不能审核</div>
}


